# Create your views here.
from market.models import DigitalContract, LastVisitedContract
from datetime import datetime, date, time



###########################################################################################
# return the last visited contract, and fix it if the expiry date is passed
def getLastVisitedContract( player ):
        lastVisitedContract = LastVisitedContract.objects.get( player = player )
        if lastVisitedContract.contract.expiry < datetime.now() and lastVisitedContract.contract.settlementStatus == -2:
                lastVisitedContract.contract.settlementSatus = -1
                lastVisitedContract.contract.save()
        return lastVisitedContract.contract
